﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ArticleCategories.aspx.cs" Inherits="Hosting.ArticleCategories" validateRequest="false" %>

<%@ Register TagPrefix="oajax" Namespace="OboutInc" Assembly="obout_AJAXPage" %> 

<%@ Register Assembly="obout_Interface" Namespace="Obout.Interface" TagPrefix="obout" %>

<%@ Register Assembly="obout_Window_NET" Namespace="OboutInc.Window" TagPrefix="owd" %>

<%@ Register Assembly="obout_SuperForm" Namespace="Obout.SuperForm" TagPrefix="obout" %>

<%@ Register Assembly="obout_Grid_NET" TagPrefix="obout" Namespace="Obout.Grid" %>

<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<a href="#" id="anchorGridNotification"></a>
<div class="notification attention png_bg" id="divGridValidation" style="display:none;">
	<div id="divGridNotification" runat="server">
        <label id="GridNotificationLabel">Update status of control.</label>
	</div>
</div>
<asp:UpdatePanel ID="udp1" runat="server">
<ContentTemplate>
<div style="position: relative; z-index: 0;">

<%--Article Group--%>
<obout:Grid id="gGroup" runat="server" AutoGenerateColumns="False" CallbackMode="false" Serialize="false"
    DataSourceID="ldsMainGroup" AllowFiltering="true"
    AllowColumnResizing="false"
    AllowRecordSelection="false"
    OnInsertCommand="gGroup_InsertCommand"
    OnUpdateCommand="gGroup_UpdateCommand"
    OnDeleteCommand="gGroup_DeleteCommand" PageSizeOptions="5,10,20,50" AllowManualPaging="True" AllowMultiRecordSelection="False">

<ScrollingSettings ScrollWidth="900px" />
<ClientSideEvents ExposeSender="true" OnBeforeClientDelete="gGroup_BeforeClientDelete" OnBeforeClientInsert="Validation" OnBeforeClientUpdate="Validation" />

<Columns>
    <obout:Column DataField="AGId" HeaderText="ID" Visible="false" ReadOnly="true" Width="50px" />
    <obout:Column DataField="AGName" HeaderText="Name"  runat="server" />
    <obout:Column DataField="AGDescription" HeaderText="Description" Width="380px">
        <TemplateSettings EditTemplateId="tplEditDescription" />
    </obout:Column>
    <obout:Column DataField="AGActive" HeaderText="Active" runat="server">
        <TemplateSettings EditTemplateID="tplEditActive" />
    </obout:Column>
    <obout:Column AllowEdit="true" AllowDelete="true" AllowSorting="false" />
</Columns>
<Templates>
    <obout:GridTemplate runat="server" ID="tplEditActive" ControlID="cbActive" ControlPropertyName="checked">
        <Template>
            <input type="checkbox" id="cbActive"/>
        </Template>
    </obout:GridTemplate>
    <obout:GridTemplate runat="server" ID="tplEditDescription" ControlID="cbDescription">
        <Template>
            <obout:OboutTextBox ID="cbDescription" Width="880px" runat="server" TextMode="MultiLine" Height="100px"></obout:OboutTextBox>
        </Template>
    </obout:GridTemplate>
</Templates>


</obout:Grid>

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="udp1">
        <ProgressTemplate>
			<div class="loading-image">
				<img src="../img/loaderWhite.gif" alt="Not image">
			</div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    </div>
</ContentTemplate>
</asp:UpdatePanel>

<asp:LinqDataSource EnableInsert="true" EnableDelete="true" EnableUpdate="true" ID="ldsMainGroup"
    ContextTypeName="Hosting.Class.HostingDomainWebsiteDataContext"
    TableName="TBL_ArticleGroups" runat="server" />

</asp:Content>

<asp:Content runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/javascript" src="js/MessageValid.js"></script>    <%--Show Message--%>
<script type="text/javascript" src="js/Article.js"></script>
<script type="text/javascript" src="js/ArticleGroup.js"></script>
<script type="text/javascript" src="js/GridMessageValid.js"></script>
<script type="text/javascript" src="js/ckeditor.js"></script>
<script src="js/ProcessCKEditor.js" type="text/javascript"></script>

<script type="text/javascript">

    function gGroup_BeforeClientDelete(sender, record) {
        if (confirm('Are you sure you want to delete this category and children?') == false) {
            return false;
        }
        return true;
    }
    </script>

<style type="text/css">
        .super-form
        {
            margin: 12px;
        }
        
        .ob_fC table td
        {
            white-space: normal !important;
        }
        
        .command-row .ob_fRwF
        {
            padding-left: 50px !important;
        }
        
        #<%= UpdateProgress1.ClientID %>
    {
        position: absolute;
        z-index: 50; 
        top: 0px; 
        bottom: 0px; 
        left: -5px; 
        right: 5px; 
        width: auto; 
        height: auto;
        background-color: #EEEEEE;
        text-align: center;
        filter: alpha(opacity=60);
        -moz-opacity: 0.6;
        opacity: 0.6;
    }
        
    .loading-image
    {
        position: absolute;
        font-family: Verdana;
	    font-size: 10px;
	    color:#0C416F;
	    height: 10px;
	    top: 50%;	
	    bottom: 0px;
	    margin-top: -5px;	
	    left: 0px;
	    right: 0px;
	    margin-left: auto;
	    margin-right: auto;
	    text-align: center;
	    width: 100%;
    }
    </style>

<script type="text/javascript" type="text/JavaScript">

    function Validation(sender, record) {
        var isValid = ArticleGroupValid(record.AGName, record.AGDescription);
        if (isValid == 1) {
            return true;
        }
        else if (isValid == 10) {
            getMessageAttention("Article Group Name is null or empty");
        }
        else if (isValid == 11) {
            getMessageAttention("Article Group Name is greater than 50");
        }
        else if (isValid == 20) {
            getMessageAttention("Article Group Description is greater than 2000");
        }
        setInterval(function () { hidediv('divGridValidation'); }, 4000);
        return false;
    }

</script>

</asp:Content>

